<!--- Statistics.cfc --->
<!---
	* Author: Cristian Costantini 
	* License: http://www.apache.org/licenses/LICENSE-2.0
	 --->

<cfcomponent output="false" name="Statistics">
    
    <!--- private --->
    
    <cffunction name="setStatistics" access="private" returntype="void" output="false">
        <cfargument name="statistics" type="Any" required="true" />
		
        <cfset variables.statistics = arguments.statistics />
    </cffunction>
    
    <cffunction name="getStatistics" access="public" returntype="Any" output="false">
    
        <cfreturn variables.statistics />
    </cffunction>
    
    <!--- constructor --->
    
    <cffunction name="init" access="public" returntype="Statistics" output="false">
        <cfargument name="cache" type="Any" required="true" />
        <cfset variables.statistics = arguments.cache.getStatistics() />
        <cfreturn this />
    </cffunction>
    
    <cffunction name="getCacheName" access="public" returntype="string" output="false" hint="Return cache Name">
        <cfreturn getStatistics().getAssociatedCache().getName() >
    </cffunction>
    
    <cffunction name="clearStatistics" access="public" returntype="void" output="false" hint="Clears the statistic counters to 0 for the associated Cache.">
        <cfset getStatistics().clearStatistics() />
    </cffunction>
    
    <cffunction name="getAverageGetTime" access="public" returntype="Numeric" output="false" hint="The average get time.">
        <cfreturn getStatistics().getAverageGetTime() />
    </cffunction>
    
    <cffunction name="getDiskStoreObjectCount" access="public" returntype="Numeric" output="false" hint="Return the number of objects in the disk store">
        <cfreturn getStatistics().getDiskStoreObjectCount() />
    </cffunction>
    
    <cffunction name="getMemoryStoreObjectCount" access="public" returntype="Numeric" output="false" hint="Return the number of objects in the memory store">
        <cfreturn getStatistics().getMemoryStoreObjectCount() />
    </cffunction>
    
    <cffunction name="getObjectCount" access="public" returntype="Numeric" output="false" hint="Gets the number of elements stored in the cache.">
        <cfreturn getStatistics().getObjectCount() />
    </cffunction>
    
    <cffunction name="getOnDiskHits" access="public" returntype="Numeric" output="false" hint="Number of times a requested item was found in the Disk Store.">
        <cfreturn getStatistics().getOnDiskHits() />
    </cffunction>
    
    <cffunction name="getInMemoryHits" access="public" returntype="Numeric" output="false" hint="Number of times a requested item was found in the Memory Store.">
        <cfreturn getStatistics().getInMemoryHits() />
    </cffunction>
    
    <cffunction name="getCacheHits" access="public" returntype="Numeric" output="false" hint="The number of times a requested item was found in the cache.">
        <cfreturn getStatistics().getCacheHits() />
    </cffunction>
    
    <cffunction name="getCacheMisses" access="public" returntype="Numeric" output="false" hint="Return the number of times a requested element was not found in the cache">
        <cfreturn getStatistics().getCacheMisses() />
    </cffunction>
    
    <cffunction name="getStatisticsAccuracyDescription" access="public" returntype="String" output="false" hint="Accurately measuring statistics can be expensive.">
        <cfreturn getStatistics().getStatisticsAccuracyDescription() />
    </cffunction>

</cfcomponent>